'''
重写继承API父类
'''




from collections import OrderedDict

from flask_restful import Api

from common.ttapi.output import output_json


class BaseApi(Api):

    def __init__(self, app=None, prefix='',
                 default_mediatype='application/json', decorators=None,
                 catch_all_404s=False, serve_challenge_on_401=False,
                 url_part_order='bae', errors=None):
        # 为了改api中self.representations的这个属性  其他不变继承父类的属性---使用super
        super().__init__( app=app, prefix=prefix,
                 default_mediatype=default_mediatype, decorators=decorators,
                 catch_all_404s=catch_all_404s, serve_challenge_on_401=serve_challenge_on_401,
                 url_part_order=url_part_order, errors=errors)
        self.representations = OrderedDict([('application/json', output_json)])